import { createStore } from 'vuex'

export default createStore({
  state: {
    userInfo: sessionStorage.getItem('userInfo')
  },
  mutations: {
    setUserInfo: (state, userInfo) => {
      state.userInfo = userInfo
      sessionStorage.setItem("userInfo", userInfo)
    },
    removeUserInfo: (state) => {
      state.userInfo = {}
      sessionStorage.removeItem('userInfo')
    }
  },
  getters: {
    getUser: state => {
      return state.userInfo
    }
  },
  actions: {
  },
  modules: {
  }
})
